import { Injectable } from '@angular/core';
import { HttpserviceProvider } from '../httpservice/httpservice';

/*
  Generated class for the BusiserviceProvider provider.

  See https://angular.io/guide/dependency-injection for more info on providers
  and Angular DI.
*/
@Injectable()
export class BusiserviceProvider {

  constructor(private httpservice: HttpserviceProvider) {
    console.log('Hello BusiserviceProvider Provider');
  }

  login(username, password) {
    return this.httpservice.post("/login/login?username=" + username + "&password=" + password);
  }
  getCardList(pagenum,searchtext?) {
    return this.httpservice.post("/card/getCardList?searchtext=" + searchtext+"&pagenum="+pagenum);
  }
  getMyCard(){
    return this.httpservice.post("/card/getMyCard");
  }
  saveMyCard(mycard){
    return this.httpservice.post("/card/saveOrUpdateMycard",mycard);
  }
  favOrUnfav(cardid){
    return this.httpservice.post("/card/favOrUnfav?cardid="+cardid);
  }
  getMyFavCard(){
    return this.httpservice.post("/card/getMyfavCardList");
  }
  changePassword(newpassword,oldpassword){
    return this.httpservice.post("/card/changePassword?password="+newpassword+"&oldpassword="+oldpassword);
  }
}
